home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / X11 / Xsession.d / 20x11-common_process-args next >
Encoding:
Text File  |  2010-10-13  |  2.0 KB  |  71 lines

  1. # $Id: 20x11-common_process-args 305 2005-07-03 18:51:43Z dnusinow $
  2.  
  3. # This file is sourced by Xsession(5), not executed.
  4.  
  5. # read OPTIONFILE
  6. OPTIONS=$(cat "$OPTIONFILE") || true
  7.  
  8. has_option() {
  9.   if [ "${OPTIONS#*
  10. $1}" != "$OPTIONS" ]; then
  11.     return 0
  12.   else
  13.     return 1
  14.   fi
  15. }
  16.  
  17. # Determine how many arguments were provided.
  18. case $# in
  19.   0)
  20.     # No arguments given; use default behavior.
  21.     ;;
  22.   1)
  23.     # One argument given; see what it was.
  24.     case "$1" in
  25.       failsafe)
  26.         # Failsafe session was requested.
  27.         if has_option allow-failsafe; then
  28.           if [ -e /usr/bin/x-terminal-emulator ]; then
  29.             if [ -x /usr/bin/x-terminal-emulator ]; then
  30.               exec x-terminal-emulator -geometry +1+1
  31.             else
  32.               # fatal error
  33.               errormsg "unable to launch failsafe X session ---" \
  34.                        "x-terminal-emulator not executable; aborting."
  35.             fi
  36.           else
  37.             # fatal error
  38.             errormsg "unable to launch failsafe X session ---" \
  39.                      "x-terminal-emulator not found; aborting."
  40.           fi
  41.         fi
  42.         ;;
  43.       default)
  44.         # Default behavior was requested.
  45.         ;;
  46.       *)
  47.         # Specific program was requested.
  48.         STARTUP_FULL_PATH=$(/usr/bin/which "$1" || true)
  49.         if [ -n "$STARTUP_FULL_PATH" ] && [ -e "$STARTUP_FULL_PATH" ]; then
  50.           if [ -x "$STARTUP_FULL_PATH" ]; then
  51.             STARTUP="$1"
  52.           else
  53.             message "unable to launch \"$1\" X session ---" \
  54.                     "\"$1\" not executable; falling back to default session."
  55.           fi
  56.         else
  57.           message "unable to launch \"$1\" X session ---" \
  58.                   "\"$1\" not found; falling back to default session."
  59.         fi
  60.         ;;
  61.     esac
  62.     ;;
  63.   *)
  64.     # More than one argument given; we don't know what to do.
  65.     message "unsupported number of arguments ($#); falling back to default" \
  66.             "session."
  67.     ;;
  68. esac
  69.  
  70. # vim:set ai et sts=2 sw=2 tw=80:
  71.